define(["jquery","bbcare"],function($,$bb){
	var comm = {};

	/**
     * 添加、修改药品时的校验
     */
	comm.validateMedicine = function(obj){
		var result = true;
        for(var key in obj){
            if( !obj[key] || obj[key] == "" ){
                switch(key){
                    case "medicineName":
                        $bb.toastShow("药品名称不能为空");
                        return false;
                    case "frequencyDay":
                        $bb.toastShow("服用周期天数不能为空");
                        return false;
                    case "frequencyTime":
                        $bb.toastShow("服用周期次数不能为空");
                        return false;
                    case "medicineDose":
                        $bb.toastShow("药品剂量不能为空");
                        return false;
                }
            }
            if( key == "medicineDose" && obj[key] == "0" ){
                $bb.toastShow("药品剂量不能为0");
                return false;
            }
        }
        return result;
	}

	return comm;
});